/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.Kernel;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.BasicBehaviors.Behavior;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;


/**
 * @generated
 *
 */
public class OpaqueExpression extends ValueSpecification implements IOpaqueExpression {
	// attributes
	
	protected String body;
	
	protected String languae;
	
	
	
	
	// references
	
	protected MetaTypedList result;
	
	protected MetaTypedList behavior;
	
	
	
	// getters & setters for attributes
	
	@MethodProperty(
			id = "OPAQUEEXPRESSION_BODY",
			catalog = "Model",
			name = ModelPackage.OPAQUEEXPRESSION_BODY,
			setter = "setBody"
			)
	
	public String getBody() {
		return body;
	}
	public void setBody(String newBody) {
		String oldbody = body;
		body = newBody;
		firePropertyChange(ModelPackage.OPAQUEEXPRESSION_BODY, oldbody, newBody);
	}
	
	@MethodProperty(
			id = "OPAQUEEXPRESSION_LANGUAE",
			catalog = "Model",
			name = ModelPackage.OPAQUEEXPRESSION_LANGUAE,
			setter = "setLanguae"
			)
	
	public String getLanguae() {
		return languae;
	}
	public void setLanguae(String newLanguae) {
		String oldlanguae = languae;
		languae = newLanguae;
		firePropertyChange(ModelPackage.OPAQUEEXPRESSION_LANGUAE, oldlanguae, newLanguae);
	}
	
	// getters for references
	
	public MetaTypedList getResult() {
		if(result == null) {
			result = new MetaTypedList(Parameter.class, this, ModelPackage.OPAQUEEXPRESSION_RESULT);
		}
		return result;
	}
	
	public MetaTypedList getBehavior() {
		if(behavior == null) {
			behavior = new MetaTypedList(Behavior.class, this, ModelPackage.OPAQUEEXPRESSION_BEHAVIOR);
		}
		return behavior;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.OPAQUEEXPRESSION_BODY, body);
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.OPAQUEEXPRESSION_LANGUAE, languae);
		
		// references
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.OPAQUEEXPRESSION_RESULT, result);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.OPAQUEEXPRESSION_BEHAVIOR, behavior);		
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		body = XMLUtility.xmlInstance.deSerializeString(root, ModelPackage.OPAQUEEXPRESSION_BODY);
		
		languae = XMLUtility.xmlInstance.deSerializeString(root, ModelPackage.OPAQUEEXPRESSION_LANGUAE);
		
		// references
		
		this.getResult().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.OPAQUEEXPRESSION_RESULT, this));
		
		this.getBehavior().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.OPAQUEEXPRESSION_BEHAVIOR, this));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		// references
		
		else if(ModelPackage.OPAQUEEXPRESSION_RESULT.equals(featureID)) {
			getResult().add(value);
		}
		
		else if(ModelPackage.OPAQUEEXPRESSION_BEHAVIOR.equals(featureID)) {
			getBehavior().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 